com.prosc.supercontainer.plugin
Class SCResourceInfo

java.lang.Object
  extended by com.prosc.supercontainer.plugin.SCResourceInfo

public class SCResourceInfo
extends java.lang.Object

Contains metadata about a SuperContainer resource residing on the server.


Constructor Summary
SCResourceInfo(java.util.Map headers, java.lang.String filename, long contentLength, java.util.Date uploadTime)
          Construct a new SCResourceInfo
SCResourceInfo(java.util.Map headers, java.lang.String filename, long contentLength, java.util.Date uploadTime, java.lang.String md5, java.lang.String dimensionString, java.lang.Integer pageCount)
          Construct a new SCResourceInfo
 
Method Summary
 long getContentLength()
          Returns the length in bytes of the file on the server.
 java.lang.String getDimensionString()
          Returns the dimension of this image resource, or null if the dimension was not calculated on the server, or the resource is not previewable on the server.
 java.lang.String getFilename()
          Returns the name of the file (this is not normally part of the folderPath).
 java.lang.String getHeight()
           
 java.net.URL getIconUrl(SCPluginModel model)
          Returns a URL for the resource icon image.
 java.lang.String getMD5()
          Returns the MD5 hash of the file on the server, or null if the MD5 hash was not computed for this resource.
 java.lang.Integer getPageCount()
          The number of pages in the document.
 java.util.Date getUploadTime()
          Returns the date on which the file was uploaded to the server.
 java.lang.String getWidth()
           
 boolean isAutozip()
          Return whether the file was automatically zipped when uploading it to the server.
 boolean isRenderable()
          Return whether the SuperContainer server appears to be able to generate a thumbnail image version of this resource.
 java.lang.String toString()
          A string representation of the SCResourceInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SCResourceInfo

SCResourceInfo(java.util.Map headers,
               java.lang.String filename,
               long contentLength,
               java.util.Date uploadTime)
Construct a new SCResourceInfo

Parameters:
headers - used to get additional headers such as X-SuperContainer-IconURL, X-SuperContainer-AutoZip. The keys and values should be strings.
filename - filename
contentLength - content length
uploadTime - when the file was uploaded

SCResourceInfo

SCResourceInfo(java.util.Map headers,
               java.lang.String filename,
               long contentLength,
               java.util.Date uploadTime,
               java.lang.String md5,
               java.lang.String dimensionString,
               java.lang.Integer pageCount)
Construct a new SCResourceInfo

Parameters:
headers - headers
filename - filename
contentLength - content length
uploadTime - upload time
md5 - md5 hash
dimensionString - dimension as WxH
pageCount - number of pages
Method Detail

getContentLength

public long getContentLength()
Returns the length in bytes of the file on the server.

Returns:
length in bytes of the file on the server.

getDimensionString

public java.lang.String getDimensionString()
Returns the dimension of this image resource, or null if the dimension was not calculated on the server, or the resource is not previewable on the server.

Returns:
width and height, e.g. 1024x768

getFilename

public java.lang.String getFilename()
Returns the name of the file (this is not normally part of the folderPath).

Returns:
the name of the file (this is not normally part of the folderPath).

getHeight

public java.lang.String getHeight()

getIconUrl

public java.net.URL getIconUrl(SCPluginModel model)
                        throws java.net.MalformedURLException
Returns a URL for the resource icon image. This may return null if no icon is available.

Parameters:
model - the model, which is used to get the superContainerBase for host-relative URLs
Returns:
url for the resource icon
Throws:
java.net.MalformedURLException - x

getMD5

public java.lang.String getMD5()
Returns the MD5 hash of the file on the server, or null if the MD5 hash was not computed for this resource.

Returns:
the MD5 hash of the file on the server, or null if the MD5 hash was not computed for this resource.

getPageCount

public java.lang.Integer getPageCount()
The number of pages in the document. Currently only supported for PDF types when the SuperContainer server is running on OS X in standalone mode.

Returns:
page count

getUploadTime

public java.util.Date getUploadTime()
Returns the date on which the file was uploaded to the server.

Returns:
the date on which the file was uploaded to the server.

getWidth

public java.lang.String getWidth()

isAutozip

public boolean isAutozip()
Return whether the file was automatically zipped when uploading it to the server. Files are autozipped when uploading a directory or OS X bundle to SuperContainer via the Applet or SCPluginModel.

Returns:
whether the file was automatically zipped when uploading it to the server.

isRenderable

public boolean isRenderable()
Return whether the SuperContainer server appears to be able to generate a thumbnail image version of this resource.

Note: This may vary from server to server for similar file types (PDF, etc).

Returns:
Whether the SuperContainer server appears to be able to generate a thumbnail image version of this resource.

toString

public java.lang.String toString()
A string representation of the SCResourceInfo.

Overrides:
toString in class java.lang.Object
Returns:
information about the resource